//导入request.js 请求工具
import request from '@/utils/request.js'
import { useTokenStore } from '@/stores/token.js'//引入token函数
//文章分类列表查询
export const articleCategoryListService = () => {
    //有请求拦截器所以注释掉
    /*  const tokenStore = useTokenStore();
       //通过请求头Authorization携带token 在pinia中定义的响应式数据都不需要.value
     return request.get('/category', { headers: { 'Authorization': tokenStore.token }}) */
    return request.get('/category')

}
//文章分类添加
export const articleCategoryAddService = (categoryModel) => {

    return request.post('/category', categoryModel)

}
//修改分类
export const articleCategoryUpdateService = (categoryModel) => {
    return request.put('/category', categoryModel)
}
//删除分类
export const articleCategoryDeleteService = (id) => {
    return request.delete('/category?id=' + id)
}

//文章管理列表查询  params对象形式传入
export const articleListService = (params) => {
    return request.get('/article', { params: params })
}

//添加文章
export const articleAddService = (articleModel) => {
    return request.post('/article', articleModel)
}
//删除文章
export const articleDeleteService = (id) => {
    return request.delete('/article?id=' + id)
}

//修改文章
export const articleUpdateService = (articleModel) => {
    return request.put('/article/update', articleModel)
}


